#ifndef INVENTORY_H
#define INVENTORY_H

#include "utilities.h"
#include "inventorybutton.h"
#include <QWidget>
#include <QMap>
#include <QTimer>

class Inventory : public QWidget
{
   Q_OBJECT
public:
   explicit Inventory(QWidget *parent = 0);
   virtual ~Inventory();
   virtual void resizeEvent(QResizeEvent *event);

   void addButton(const quint32 id, const EntityBaseStats &stats);
   void removeSelection();
   void incSelection();
   void decSelection();
   void clearSelection();
   bool hasSelection();
   bool isSelectionModifiable();
   bool setSelectionStats(const EntityBaseStats &stats);
   EntityBaseStats selectionStats();
   EntitySquadType* selection();
   void setSelection(const quint32 id, const bool emitSignal=true);
   void setDisabled(const quint32 id, const bool value=true);
   void setColorForAllButtons(const QColor &color);

signals:
   void newSelection(quint32 squadID);

public slots:
   void onInvButton();
   void tick();

protected:
   void repositionButtons();
   QMap<quint32, EntitySquadType*> mSquadMap;
   QMap<quint32, InventoryButton*> mButtonMap;
   quint32 mSelectionID;
   quint32 mNumButtons;
   qreal mPulsateScale;
   bool mPulsateCountUp;
   QTimer *mPulsateTimer;
};

#endif // INVENTORY_H
